﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.AlbLab.GEP.Domain.Entities;

namespace Com.AlbLab.CR.Web.controls
{
    public partial class PraticaViewerSmall : System.Web.UI.UserControl
    {
        public GEP_TESTATA entity = null;
        public string Pratica_id
        {
            get { return this.lblID.Text; }
            set { this.lblID.Text = value; }
        }

        public bool ShowDettagliLink
        {
            get { return btnDett.Visible; }
            set { btnDett.Visible = value; }
        }
        public bool ShowPraticaLink
        {
            get { return btnBack.Visible; }
            set { btnBack.Visible = value; }
        }

        public string Codice_Servizio
        {
            get { return this.lblTipoPrt.Text; }
            set { this.lblTipoPrt.Text = value; }
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                this.lblID.Text = entity.Id_tes_cod_pratica.ToString();
                this.lblTipoPrt.Text = entity.Tes_Cod_Servizio;
                this.lblDescrPrt.Text = common.pages.BasePage.Services.AnagraficheService.getListaServizi()[entity.Tes_Cod_Servizio].Ser_des_servizio;
                this.lblNomeRic.Text = entity.Tes_DBA_Ragsoc_Cli;
            }
        }

        protected void btnBack_OnClick(object sender, EventArgs e)
        {
            common.TempSession.setBag("CODICE_PRATICA", decimal.Parse(this.lblID.Text));
            Response.Redirect("Pratica.aspx");
        }

        protected void btnDett_OnClick(object sender, EventArgs e)
        {
            common.TempSession.setBag("CODICE_PRATICA", decimal.Parse(this.lblID.Text));
            switch (Codice_Servizio)
            {
                case "D01":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_D01.aspx");
                    break;
                case "R01":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_R01.aspx");
                    break;
                case "V02":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_V02.aspx");
                    break;
                case "V01":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_V01.aspx");
                    break;
                case "M02":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_M02.aspx");
                    break;
                case "M01":
                    Response.Redirect("~/Pratiche/PaginePratiche/PST_M01.aspx");
                    break;
                case "VT0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_VT0.aspx");
                    break;
                case "SB0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SB0.aspx");
                    break;
                case "SW0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SW0.aspx");
                    break;
                case "SW1":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SW1.aspx");
                    break;
                case "SM0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SM0.aspx");
                    break;
                case "SG0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SG0.aspx");
                    break;
                case "CA0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_CA0.aspx");
                    break;
                case "RF0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_RF0.aspx");
                    break;
                case "PR0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_PR0.aspx");
                    break;
                case "EL1":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_EL1.aspx");
                    break;
                case "VA0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_VA0.aspx");
                    break;
                case "SG1":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SG1.aspx");
                    break;
                case "SI0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_SI0aspx");
                    break;
                case "RE0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_RE0.aspx");
                    break;
                case "RE1":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_RE1.aspx");
                    break;
                case "EL0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_EL0.aspx");
                    break;
                case "AP0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_AP0.aspx");
                    break;
                case "VP0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_VP0.aspx");
                    break;
                case "CF0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_CF0.aspx");
                    break;
                case "CT0":
                    Response.Redirect("~/Pratiche/PaginePratiche/PNS_CT0.aspx");
                    break;
            }

        }

    }
}